/**
 * @desc
 *
 * @使用场景
 *
 * @company qianmi.com
 * @Date    2017/8/22
 **/
import React from 'react';
import ReactDOM from 'react-dom';
import '@qianmi/x-site-openapi/src/dll-context';

import EditorService from '@qianmi/x-site-openapi/src/editor-service';
import TemplateService from '@qianmi/x-site-openapi/src/template-service';
// import '@qianmi/x-site-openapi/src/publish-service';
// import  '@qianmi/x-site-openapi/src/publish-util/publish-center';

import WidgetCenter from '@qianmi/x-site-core/lib/widget/widget-center';

import h from '../widget/horizontal-layout';
import hp from '../widget/horizontal-layout-p';

(async()=>{

    let http={};
    let openApiClient = {};
    let tplCode ='goodsDesc';

    WidgetCenter.registerWidget(h,{
        widgetNameSpace:"x-site-ui-goods-desc/widget-bar/layout/goods-simple-layout-bar"
    });

    WidgetCenter.registerWidget(hp,{
        isProxy:true,
        widgetNameSpace:"x-site-ui-goods-desc/widget-bar/layout/goods-simple-layout-bar"
    });

    let editorService =new EditorService(http,{openApiClient});
    // let pageInfo = {
    //     pageType:'index',
    //     platform:"weixin",
    //     tplCode,
    //     title:"test",
    //     pageCode:"index",
    //     configOrder:{
    //         "widgetNameSpace" : "x-site-ui-goods-desc/widget-bar/layout/goods-simple-layout-bar",
    //         "children" : [
    //             {
    //                 "props" : {
    //                     "items" : [
    //                         {
    //                             "imgSrc" : "//img.1000.com/qm-a-img/prod/1224369/ce127fecfccd2dc03c037f3f0068d089.png"
    //                         },
    //                         {
    //                             "imgSrc" : "//qianmi-web.oss-cn-hangzhou.aliyuncs.com/x-site/public/x-site-ui-goods-desc/statics/preview/goods-details-02.jpg"
    //                         },
    //                         {
    //                             "imgSrc" : "//qianmi-web.oss-cn-hangzhou.aliyuncs.com/x-site/public/x-site-ui-goods-desc/statics/preview/goods-details-03.jpg"
    //                         },
    //                         {
    //                             "imgSrc" : "//qianmi-web.oss-cn-hangzhou.aliyuncs.com/x-site/public/x-site-ui-goods-desc/statics/preview/goods-details-08.jpg"
    //                         },
    //                         {
    //                             "imgSrc" : "//img.1000.com/qm-a-img/prod/1224369/ff4eb18c1036f533c89f2d72283e911c.map(map)"
    //                         }
    //                     ],
    //                     "key" : "93c38860-7be2-11e7-b1c9-bf384444fede"
    //                 },
    //                 "widgetNameSpace" : "x-site-ui-goods-desc/widget-bar/details-img/demo1/details-img-bar"
    //             }
    //         ]
    //     }
    // };

    let pageInfo = {
        pageType:'index',
        platform:"weixin",
        tplCode,
        title:"test",
        pageCode:"index",
        configOrder:{
            "widgetNameSpace" : "x-site-ui-goods-desc/widget-bar/layout/goods-simple-layout-bar",
            "children" : [{
                "widgetNameSpace" : "x-site-ui-goods-desc/widget-bar/layout/goods-simple-layout-bar"
            }]
        }
    };


    editorService.initEditorArea({
        pageInfo,target:document.getElementById('x-site')});
})();